Remove indexed tx graph (2)#1875
Closed
evanlinjin wants to merge 2 commits intobitcoindevkit:masterfrom
Closed
Conversation
a202349 to
7d8ffae
Compare
in favour of adding a type parameter to TxGraph. When the second type parameter `X: Indexer` is set then TxGraph behaves like `IndexedTxGraph` used to. I reworked the internals of `TxGraph` as I thought things were a bit convoluted. - feat: allow changing the indexer on TxGraph Co-authored: LLFourn
The serialization format of the nested structure is exactly the same as the as the old `indexed_tx_graph::ChangeSet`. The old `tx_graph::ChangeSet` is replaced with `tx_graph::TxChangeSet`.
7d8ffae to
1c026d6
Compare
ValuedMammal
approved these changes
Mar 7, 2025
Collaborator
ValuedMammal
left a comment
There was a problem hiding this comment.
Code review ACK. tested locally with no issue. I had a question about when we should be calling index_changeset, and the rest are nits.
| for (txid, seen_at) in update.seen_ats { | ||
| changeset.merge(self.insert_seen_at(txid, seen_at)); | ||
| } | ||
| self.index_changeset(&mut changeset); |
Collaborator
There was a problem hiding this comment.
Now I'm not sure if this line is needed because both insert_tx and insert_txout will call index_changeset.
| )) | ||
| )] | ||
| #[must_use] | ||
| pub struct ChangeSet<A = (), XC = ()> { |
Collaborator
There was a problem hiding this comment.
Maybe we could just call this I, but either way is fine.
Suggested change
| pub struct ChangeSet<A = (), XC = ()> { | |
| pub struct ChangeSet<A = (), I = ()> { |
| } | ||
|
|
||
| /// Changes the [`Indexer`] for a `TxGraph`. **This doesn't re-index the transactions in the | ||
| /// graph**. To do that that call [`reindex`]. |
Collaborator
There was a problem hiding this comment.
Suggested change
| /// graph**. To do that that call [`reindex`]. | |
| /// graph**. To do that call [`reindex`]. |
| } | ||
|
|
||
| impl<A: Ord> ChangeSet<A> { | ||
| /// The [`ChangeSet`] represents changes to a [`TxGraph`] and it's internal [`Indexer`]. |
Collaborator
There was a problem hiding this comment.
Suggested change
| /// The [`ChangeSet`] represents changes to a [`TxGraph`] and it's internal [`Indexer`]. | |
| /// The [`ChangeSet`] represents changes to a [`TxGraph`] and its internal [`Indexer`]. |
Member
Author
|
Closing. Refer to #1510 (comment) |
Member
|
Closing per comment mentioned above. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This is a temporary duplicate of #1510 so see if @ValuedMammal is happy with these changes.
tx_graph::ChangeSetis the nested structure.tx_graph::TxChangeSetis the changeset without the indexer data.